import request from '@/utils/request'

export function fetchById(params) {
  return request({
    url: '/core/admin123/coding/a1templatetable/selectById',
    method: 'get',
    params
  })
}


export function fetchBankupByIds(params) {
  return request({
    url: '/base/coding/tmptTable/selectBatchIds',
    method: 'get',
    params
  })
}

export function editTreeJsonById(data) {
  return request({
    url: '/core/admin123/coding/a1templatetable/editTreeJsonById',
    method: 'POST',
    data
  })
}

export function fetchList(params) {
  return request({
    url: '/core/admin123/coding/a1templatetable/page',
    method: 'get',
    params
  })
}

export function insertBankup(data) {
  return request({
    url: '/base/coding/tmptTable/insertBankup',
    method: 'POST',
    data
  })
}

export function updateApi(data) {
  return request({
    url: '/core/admin123/coding/a1templatetable/a1templatetableAjax_editData',
    method: 'POST',
    data
  })
}

export function removeApi(params) {
  return request({
    url: '/core/admin123/coding/a1templatetable/a1templatetableAjax_removeData',
    method: 'POST',
    params
  })
}

// --------------------------
//      下以是源码生成器API
// --------------------------
export function buildCodeApi(params) {
  return request({
    url: '/core/admin123/template/autocodebuilder',
    method: 'get',
    params
  })
}

export function addTemplatetableApi(data) {
  return request({
    url: '/core/admin123/template/templateAjax_addA1TemplateTable',
    method: 'POST',
    data
  })
}

// 自动给模板表列，加载列数据，方便配置
export function addTemplatetableColumnApi(params) {
  return request({
    url: '/core/admin123/template/templateAjax_loadColumn',
    method: 'POST',
    params
  })
}

// 生成源码，和菜单配置
export function gen2LevelMenuApi(params) {
  return request({
    url: '/core/admin123/mpgenerator/template2menu',
    method: 'POST',
    params
  })
}
